#ifndef PLATFORM_H
#define PLATFORM_H

#include <QMainWindow>
#include"node.h"
#include"edge.h"
#include"myscene.h"
namespace Ui {
class platform;
}

class platform : public QMainWindow
{
    Q_OBJECT

public:
    explicit platform(QWidget *parent = nullptr);
    ~platform();
    int start,end;

    QList<Node*> nodes;
    QList<Edge*> edges;


    int size=50;//节点大小，默认长宽50像素
    int curID=-1;//鼠标选中当前节点id
    bool isDrawing=0;//正在连线的标志，1表示正在连线
    bool isDragging=0;//正在拖拽的标志，1表示正在拖拽
    Edge * edge;
    MyScene * scene;
    void scene_init();
    void view_init();
    void connect_init();

private:
    Ui::platform *ui;

private slots:
    void on_mouseDoubleClick(QMouseEvent *e);
    void on_mousePress(QMouseEvent *e);
    void on_mouseMove(QMouseEvent *e);
    void on_keyPress(QKeyEvent *e);
    void on_mouseRelease(QMouseEvent *e);
//    void on_start_but_clicked();
//    void on_open_but_clicked();
//    void on_play_but_clicked();
    void on_big_act_triggered();
    void on_small_act_triggered();
    void on_grid_act_triggered();
};

#endif // PLATFORM_H
